package top.toptimus.dto.barcode;

import com.google.common.base.Strings;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import top.toptimus.util.DateTimeUtil;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class BarcodeInfoDTO {
    private String qrType;
    private String qrBarCode;
    private String qrName;
    private String qrOther1;
    private String qrOther2;
    private String qrOther4;
    private String qrOther10;  //  订单号
    private String qrOther11;  //  店名
    private String qrOther12;
    private String qrOther13;
    private String qrOther14;
    private String qrOther26;
    private String qrOther27;
    private String qrOther28;
    private String qrOther29;
    private String qrOther30;
    private String qrOther31;
    private String qrOther32;
    private String qrOther33;
    private String printFlag;
    private String enableFlag;
    private String deleteFlag;
    private String remarks;
    private String version;
    private String createDate;
    private String createUser;
    private String updateDate;
    private String updateUser;

    public BarcodeInfoDTO(OrderDTO orderDTO, FabricDTO fabricDTO, CustomerDTO customerDTO) {
        this.qrType = "5";
        this.qrBarCode = orderDTO.getOrderNO().substring(orderDTO.getOrderNO().length() - 6, orderDTO.getOrderNO().length()); //  条码
        this.qrName = Strings.isNullOrEmpty(orderDTO.getBusinessNo()) ? orderDTO.getOrderNO() : orderDTO.getBusinessNo(); //  订单号
        this.qrOther1 = DateTimeUtil.getCurrentDateTime();
        this.qrOther2 = "ORDER_FLAG-normal_10";
        //this.qrOther4 = orderDTO.getStyleID();
        this.qrOther4 = fabricDTO.getMaterialCode();
        this.qrOther10 = orderDTO.getOrderNO();

        this.qrOther11 = "春衫SSHIRT";
        this.qrOther12 = orderDTO.getCustomTrueName();//  姓名
        this.qrOther13 = orderDTO.getCustomMakeShirt();

        try {
            this.qrOther14 = orderDTO.getBusinessNo().substring(orderDTO.getBusinessNo().length() - 10, orderDTO.getBusinessNo().length());
        } catch (Exception exception) {
            this.qrOther14 = this.qrName;
        }

        this.qrOther26 = orderDTO.getCustomTrueName();
        if (customerDTO != null) {
            this.qrOther27 = customerDTO.getMobile();
            this.qrOther28 = customerDTO.getAddressProvinceCD();
            this.qrOther29 = customerDTO.getAddresscityCD();
            this.qrOther30 = customerDTO.getAddressDistrict();
            this.qrOther31 = customerDTO.getAddressDetail();
            this.qrOther32 = customerDTO.getZipCode();
        }
        this.qrOther33 = fabricDTO.getMaterialComposition(); //  成分
        this.printFlag = "0";
        this.enableFlag = "1";
        this.deleteFlag = "0";
//        this.remarks = "";
        this.version = "1";
        this.createDate = DateTimeUtil.getCurrentDateTime();
        this.createUser = "1";
        this.updateDate = DateTimeUtil.getCurrentDateTime();
        this.updateUser = "1";

    }
}

